package com.zf.sqlite.utils;

import androidx.room.Entity;
import androidx.room.PrimaryKey;
import androidx.room.ColumnInfo;

import com.zf.basetools.DateToolsUtils;
import com.zf.zfed.audit.R;

@Entity(tableName = "zfed_whitelist")
public class WhitelistEntity {
    @PrimaryKey(autoGenerate = true)
    public long id;

    @ColumnInfo(name = "type")
    public int type; // 1：蓝牙 2：wifi 3：移动设备 4：苹果设备

    @ColumnInfo(name = "device_name")
    public String device_name;

    @ColumnInfo(name = "device_mac")
    public String device_mac;

    @ColumnInfo(name = "device_manufacturer")
    public String device_manufacturer;

    @ColumnInfo(name = "whitelist_add_time")
    public String whitelist_add_time;

    @ColumnInfo(name = "remarks")
    public String remarks;

    // 构造函数
    public WhitelistEntity(int type, String device_name, String device_mac, String device_manufacturer, String remarks) {
        this.type = type;
        this.device_name = device_name;
        this.device_mac = device_mac;
        this.device_manufacturer = device_manufacturer;
        this.remarks = remarks;
        this.whitelist_add_time = DateToolsUtils.getCurrentTime("yyyy-MM-dd HH:mm:ss");
    }

    // 默认构造函数
    public WhitelistEntity() {}

    // Getters and Setters
    public long getId() { return id; }
    public void setId(long id) { this.id = id; }

    public int getType() { return type; }
    public void setType(int type) { this.type = type; }

    public String getDevice_name() { return device_name; }
    public void setDevice_name(String device_name) { this.device_name = device_name; }

    public String getDevice_mac() { return device_mac; }
    public void setDevice_mac(String device_mac) { this.device_mac = device_mac; }

    public String getDevice_manufacturer() { return device_manufacturer; }
    public void setDevice_manufacturer(String device_manufacturer) { this.device_manufacturer = device_manufacturer; }

    public String getWhitelist_add_time() { return whitelist_add_time; }
    public void setWhitelist_add_time(String whitelist_add_time) { this.whitelist_add_time = whitelist_add_time; }

    public String getRemarks() { return remarks; }
    public void setRemarks(String remarks) { this.remarks = remarks; }

    // 获取类型显示名称
    public String getTypeDisplayName() {
        switch (type) {
            case 1: return "信号";
            case 2: return "WiFi";
            case 3: return "蓝牙";
            case 4: return "移动通信";
            case 5: return "音视频";
            default: return "未知";
        }
    }

    // 获取类型图标资源ID
    public int getTypeIconResId() {
        switch (type) {
            case 1: return R.drawable.u275;
            case 2: return R.drawable.u790;
            case 3: return R.drawable.u1060;
            case 4: return R.drawable.u44;
            case 5: return R.drawable.u68;
            default: return R.drawable.ic_unknown;
        }
    }
}
